<!DOCTYPE html>
            <html>
                <head>                    
                    <meta http-equiv="X-UA-Compatible" content="IE=edge">
                    <meta http-equiv="content-type" content="text/html; charset=utf-8">
                    <title>readme.md</title>
                    <style type="text/css">
                    /*
Copyright (c) 2017 Chris Patuzzo
https://twitter.com/chrispatuzzo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

body {
  font-family: Helvetica, arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  padding-top: 10px;
  padding-bottom: 10px;
  background-color: white;
  padding: 30px;
  color: #333;
}

body &gt; *:first-child {
  margin-top: 0 !important;
}

body &gt; *:last-child {
  margin-bottom: 0 !important;
}

a {
  color: #4183C4;
  text-decoration: none;
}

a.absent {
  color: #cc0000;
}

a.anchor {
  display: block;
  padding-left: 30px;
  margin-left: -30px;
  cursor: pointer;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
}

h1, h2, h3, h4, h5, h6 {
  margin: 20px 0 10px;
  padding: 0;
  font-weight: bold;
  -webkit-font-smoothing: antialiased;
  cursor: text;
  position: relative;
}

h2:first-child, h1:first-child, h1:first-child + h2, h3:first-child, h4:first-child, h5:first-child, h6:first-child {
  margin-top: 0;
  padding-top: 0;
}

h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, h5:hover a.anchor, h6:hover a.anchor {
  text-decoration: none;
}

h1 tt, h1 code {
  font-size: inherit;
}

h2 tt, h2 code {
  font-size: inherit;
}

h3 tt, h3 code {
  font-size: inherit;
}

h4 tt, h4 code {
  font-size: inherit;
}

h5 tt, h5 code {
  font-size: inherit;
}

h6 tt, h6 code {
  font-size: inherit;
}

h1 {
  font-size: 28px;
  color: black;
}

h2 {
  font-size: 24px;
  border-bottom: 1px solid #cccccc;
  color: black;
}

h3 {
  font-size: 18px;
}

h4 {
  font-size: 16px;
}

h5 {
  font-size: 14px;
}

h6 {
  color: #777777;
  font-size: 14px;
}

p, blockquote, ul, ol, dl, li, table, pre {
  margin: 15px 0;
}

/*
hr {
  border: 0 none;
  color: #cccccc;
  height: 4px;
  padding: 0;
}
*/
body &gt; h2:first-child {
  margin-top: 0;
  padding-top: 0;
}

body &gt; h1:first-child {
  margin-top: 0;
  padding-top: 0;
}

body &gt; h1:first-child + h2 {
  margin-top: 0;
  padding-top: 0;
}

body &gt; h3:first-child, body &gt; h4:first-child, body &gt; h5:first-child, body &gt; h6:first-child {
  margin-top: 0;
  padding-top: 0;
}

a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 {
  margin-top: 0;
  padding-top: 0;
}

h1 p, h2 p, h3 p, h4 p, h5 p, h6 p {
  margin-top: 0;
}

li p.first {
  display: inline-block;
}

ul, ol {
  padding-left: 30px;
}

ul :first-child, ol :first-child {
  margin-top: 0;
}

ul :last-child, ol :last-child {
  margin-bottom: 0;
}

dl {
  padding: 0;
}

dl dt {
  font-size: 14px;
  font-weight: bold;
  font-style: italic;
  padding: 0;
  margin: 15px 0 5px;
}

dl dt:first-child {
  padding: 0;
}

dl dt &gt; :first-child {
  margin-top: 0;
}

dl dt &gt; :last-child {
  margin-bottom: 0;
}

dl dd {
  margin: 0 0 15px;
  padding: 0 15px;
}

dl dd &gt; :first-child {
  margin-top: 0;
}

dl dd &gt; :last-child {
  margin-bottom: 0;
}

blockquote {
  border-left: 4px solid #dddddd;
  padding: 0 15px;
  color: #777777;
}

blockquote &gt; :first-child {
  margin-top: 0;
}

blockquote &gt; :last-child {
  margin-bottom: 0;
}

table {
  padding: 0;
}
table tr {
  border-top: 1px solid #cccccc;
  background-color: white;
  margin: 0;
  padding: 0;
}

table tr:nth-child(2n) {
  background-color: #f8f8f8;
}

table tr th {
  font-weight: bold;
  border: 1px solid #cccccc;
  text-align: left;
  margin: 0;
  padding: 6px 13px;
}

table tr td {
  border: 1px solid #cccccc;
  text-align: left;
  margin: 0;
  padding: 6px 13px;
}

table tr th :first-child, table tr td :first-child {
  margin-top: 0;
}

table tr th :last-child, table tr td :last-child {
  margin-bottom: 0;
}

img {
  max-width: 100%;
}

span.frame {
  display: block;
  overflow: hidden;
}

span.frame &gt; span {
  border: 1px solid #dddddd;
  display: block;
  float: left;
  overflow: hidden;
  margin: 13px 0 0;
  padding: 7px;
  width: auto;
}

span.frame span img {
  display: block;
  float: left;
}

span.frame span span {
  clear: both;
  color: #333333;
  display: block;
  padding: 5px 0 0;
}

span.align-center {
  display: block;
  overflow: hidden;
  clear: both;
}

span.align-center &gt; span {
  display: block;
  overflow: hidden;
  margin: 13px auto 0;
  text-align: center;
}

span.align-center span img {
  margin: 0 auto;
  text-align: center;
}

span.align-right {
  display: block;
  overflow: hidden;
  clear: both;
}

span.align-right &gt; span {
  display: block;
  overflow: hidden;
  margin: 13px 0 0;
  text-align: right;
}

span.align-right span img {
  margin: 0;
  text-align: right;
}

span.float-left {
  display: block;
  margin-right: 13px;
  overflow: hidden;
  float: left;
}

span.float-left span {
  margin: 13px 0 0;
}

span.float-right {
  display: block;
  margin-left: 13px;
  overflow: hidden;
  float: right;
}

span.float-right &gt; span {
  display: block;
  overflow: hidden;
  margin: 13px auto 0;
  text-align: right;
}

code, tt {
  margin: 0 2px;
  padding: 0 5px;
  white-space: nowrap;
  border: 1px solid #eaeaea;
  background-color: #f8f8f8;
  border-radius: 3px;
}

pre code {
  margin: 0;
  padding: 0;
  white-space: pre;
  border: none;
  background: transparent;
}

.highlight pre {
  background-color: #f8f8f8;
  border: 1px solid #cccccc;
  font-size: 13px;
  line-height: 19px;
  overflow: auto;
  padding: 6px 10px;
  border-radius: 3px;
}

pre {
  background-color: #f8f8f8;
  border: 1px solid #cccccc;
  font-size: 13px;
  line-height: 19px;
  overflow: auto;
  padding: 6px 10px;
  border-radius: 3px;
}

pre code, pre tt {
  background-color: transparent;
  border: none;
}

/* Syntax Highlighting */

.plainText {
 background-color: #FFFFFF;
 color: #000000;
}
.htmlServerSideScript {
 background-color: #FFFF00;
}
.htmlComment {
 color: #008000;
}
.htmlTagDelimiter {
 color: #0000FF;
}
.htmlElementName {
 color: #A31515;
}
.htmlAttributeName {
 color: #FF0000;
}
.htmlAttributeValue {
 color: #0000FF;
}
.htmlOperator {
 color: #0000FF;
}
.comment {
 color: #008000;
}
.xmlDocTag {
 color: #808080;
}
.xmlDocComment {
 color: #008000;
}
.string {
 color: #A31515;
}
.stringCSharpVerbatim {
 color: #A31515;
}
.keyword {
 color: #0000FF;
}
.preprocessorKeyword {
 color: #0000FF;
}
.htmlEntity {
 color: #FF0000;
}
.xmlAttribute {
 color: #FF0000;
}
.xmlAttributeQuotes {
 color: #000000;
}
.xmlAttributeValue {
 color: #0000FF;
}
.xmlCDataSection {
 color: #808080;
}
.xmlComment {
 color: #008000;
}
.xmlDelimiter {
 color: #0000FF;
}
.xmlName {
 color: #A31515;
}
.className {
 color: #48D1CC;
}
.cssSelector {
 color: #A31515;
}
.cssPropertyName {
 color: #FF0000;
}
.cssPropertyValue {
 color: #0000FF;
}
.sqlSystemFunction {
 color: #FF00FF;
}
.powershellAttribute {
 color: #B0E0E6;
}
.powershellOperator {
 color: #808080;
}
.powershellType {
 color: #008080;
}
.powershellVariable {
 color: #FF4500;
}
.type {
 color: #008080;
}
.typeVariable {
 color: #008080;
 font-style: italic;
}
.namespace {
 color: #000080;
}
.constructor {
 color: #800080;
}
.predefined {
 color: #000080;
}
.pseudoKeyword {
 color: #000080;
}
.stringEscape {
 color: #808080;
}
.controlKeyword {
 color: #0000FF;
}
.number {
}
.operator {
}
.delimiter {
}
.markdownHeader {
 font-weight: bold;
}
.markdownCode {
 color: #008080;
}
.markdownListItem {
 font-weight: bold;
}
.italic {
 font-style: italic;
}
.bold {
 font-weight: bold;
}

                    </style>
                </head>
                <body style="">
                <h2 id="0">FEP v3.1 功能和部署说明</h2>
<h3 id="2">1. 功能描述</h3>
<p id="4">实现基于WinCC OA的冗余/负载均衡的FEP（Front End Processor）前置机功能。</p>
<p id="6">兼容LINUX/WINDOWS，兼容中文/英文windows环境</p>
<p id="8">支持在远程运行冗余的驱动、冗余Ctrl等实现动态负载均衡，自动迁移进程。</p>
<p id="10">Console Debug Flag 调试开关：-dbg fepdbg</p>
<h3 id="12">2. 部署说明</h3>
<p id="14">新建远程项目，在config文件配置好data和event及其他与驱动相关的配置。</p>
<p id="16">拷贝fet.ctl 及/libs/fep_lib.ctl  到这个远程项目的主机和备机。</p>
<p id="18">分别在主机、备机进行部署：</p>
<p id="20">第一步：修改fet.ctl 主程序。</p>
<div id="21" class="lang-C editor-colors"><div class="cplusplus"><pre>
global <span class="keyword">const</span> string FEP_PARTNER_HOSTNAME =  <span class="string">&quot;MEP1B&quot;</span>;
global <span class="keyword">const</span> <span class="keyword">int</span> FEP_PARTNER_PMONPORT = 5000; <span class="comment">// 伙伴的PMON端口号</span>
global <span class="keyword">const</span> <span class="keyword">int</span> FEP_LOCAL_PMONPORT = 5000; <span class="comment">// 本地PMON 的端口号</span>

global <span class="keyword">const</span> dyn_mapping dmPmonConfig = makeDynMapping(
                                     makeMapping(<span class="string">&quot;target&quot;</span>, <span class="string">&quot;www.winccoa.top&quot;</span>,
                                         <span class="string">&quot;index&quot;</span>,  3,
                                         <span class="string">&quot;default&quot;</span>, <span class="string">&quot;主机&quot;</span>),
                                     makeMapping(<span class="string">&quot;target&quot;</span>, <span class="string">&quot;www.winccoa.top&quot;</span>,
                                         <span class="string">&quot;index&quot;</span>,  4,
                                         <span class="string">&quot;default&quot;</span>, <span class="string">&quot;备机&quot;</span>)
                                 );
</pre></div>
</div>
<p id="35"><code>FEP_PARTNER_HOSTNAME</code> : 在主机的fep.ctl 需填写备机的hostname。在备机的fep.ctl,填写主机的hostname。即对头号。
<code>FEP_PARTNER_PMONPORT</code> :对方的pmon端口号
<code>FEP_LOCAL_PMONPORT</code>:本地pmon的端口号
<code>dmPmonConfig</code>:MAPPING 类型的变量，将驱动对应的index，默认运行的位置，需要ping的target主机复制多份。</p>
<p id="40">第二步：
config文件必须具有开放访问的权限，例如：</p>
<div id="42" class="lang-C editor-colors"><div class="cplusplus"><pre>
[pmon]
localAddress = <span class="string">&quot;&quot;</span> 
ip_allow = <span class="string">&quot;-empty list-&quot;</span> 
ip_deny = <span class="string">&quot;-empty list-&quot;</span> 
ip_allow = <span class="string">&quot;::1&quot;</span>
ip_allow = <span class="string">&quot;127.0.0.1&quot;</span>
ip_allow = <span class="string">&quot;localhost&quot;</span>
ip_allow = <span class="string">&quot;*&quot;</span> # 默认禁用。开启web服务，远程管理项目状态。 
</pre></div>
</div>
<p id="52">第三步：
紧挨着pmon进程，新建一个ctrl manager，运行fep.ctl，设置为自动。</p>
<h3 id="55">3. 配置举例</h3>
<p id="57">主机，备机均配置了modbus 驱动（-num 25），S7驱动（-num 26）两个驱动。其中约定， Modbus 驱动运行在主机，S7驱动默认运行在备机。
配置方法：
两个驱动都设置为手动。
FEP.CTL的Ctrl Manager设置为自动。</p>
<p id="62">主机progs</p>
<pre><code id="64">#Manager         | Start  | SecKill | Restart# | ResetMin | Options
WCCILpmon        | manual |      30 |        3 |        1 |
WCCOActrl        | always |      30 |       22 |        2 |FEP.ctl
WCCOAui          | manual |      30 |        3 |        1 |-m gedi
WCCOAmod         | manual |      30 |       22 |        2 |-num 25 # 主机
WCCOAs7          | manual |      30 |        2 |        2 |-num 26 # 备机

</code></pre>
<p id="73">主机fep.ctl</p>
<div id="74" class="lang-c editor-colors"><div class="cplusplus"><pre>
global <span class="keyword">const</span> string THIS_HOST = <span class="string">&quot;主机&quot;</span>; <span class="comment">// 填写：”主机“， ”备机“。 定义本程序运行的是“主机”还是”备机“，</span>
global <span class="keyword">const</span> string FEP_PARTNER_HOSTNAME =  <span class="string">&quot;MEP1B&quot;</span>;
global <span class="keyword">const</span> <span class="keyword">int</span> FEP_PARTNER_PMONPORT = 5000; <span class="comment">// 伙伴的PMON端口号</span>
global <span class="keyword">const</span> <span class="keyword">int</span> FEP_LOCAL_PMONPORT = 5000; <span class="comment">// 本地PMON 的端口号</span>

global <span class="keyword">const</span> dyn_mapping dmPmonConfig = makeDynMapping(
                                     makeMapping(<span class="string">&quot;target&quot;</span>, <span class="string">&quot;www.winccoa.top&quot;</span>,
                                         <span class="string">&quot;index&quot;</span>,  3,
                                         <span class="string">&quot;default&quot;</span>, <span class="string">&quot;主机&quot;</span>),
                                     makeMapping(<span class="string">&quot;target&quot;</span>, <span class="string">&quot;www.winccoa.top&quot;</span>,
                                         <span class="string">&quot;index&quot;</span>,  4,
                                         <span class="string">&quot;default&quot;</span>, <span class="string">&quot;备机&quot;</span>)
                                 );


</pre></div>
</div>
<p id="91">备机progs</p>
<pre><code id="92">#Manager         | Start  | SecKill | Restart# | ResetMin | Options
WCCILpmon        | manual |      30 |        3 |        1 |
WCCOActrl        | always |      30 |       22 |        2 |FEP.ctl
WCCOAui          | manual |      30 |        3 |        1 |-m gedi
WCCOAmod         | manual |      30 |       22 |        2 |-num 25 # 主机
WCCOAs7          | manual |      30 |        2 |        2 |-num 26 # 备机

</code></pre>
<p id="102">备机fep.ctl</p>
<div id="103" class="lang-c editor-colors"><div class="cplusplus"><pre>

<span class="keyword">const</span> string THIS_HOST = <span class="string">&quot;备机&quot;</span>; <span class="comment">// 填写：”主机“， ”备机“。 定义本程序运行的是“主机”还是”备机“，</span>
<span class="keyword">const</span> string FEP_PARTNER_HOSTNAME =  <span class="string">&quot;MEP1A&quot;</span>;
<span class="keyword">const</span> <span class="keyword">int</span> FEP_PARTNER_PMONPORT = 5000; <span class="comment">// 伙伴的PMON端口号</span>
<span class="keyword">const</span> <span class="keyword">int</span> FEP_LOCAL_PMONPORT = 5000; <span class="comment">// 本地PMON 的端口号</span>

<span class="keyword">const</span> dyn_mapping dmPmonConfig = makeDynMapping( 
                                     makeMapping(<span class="string">&quot;target&quot;</span>, <span class="string">&quot;www.winccoa.top&quot;</span>,
                                         <span class="string">&quot;index&quot;</span>,  3,
                                         <span class="string">&quot;default&quot;</span>, <span class="string">&quot;主机&quot;</span>), 
                                     makeMapping(<span class="string">&quot;target&quot;</span>, <span class="string">&quot;www.winccoa.top&quot;</span>,
                                         <span class="string">&quot;index&quot;</span>,  4,
                                         <span class="string">&quot;default&quot;</span>, <span class="string">&quot;备机&quot;</span>)
                                 );
</pre></div>
</div>

                </body>
            </html>
            